import React,{Component} from 'react';
import {
  Link
} from 'react-router-dom';
import './card.scss';

export default class Card extends Component{
	constructor (props) {
		super(props)
	}
	componentDidMount () {
	}
	render(){
		return(
			<div className="card">
				<Link to={
					{
						pathname: '/shopDetail',
						state: {id: this.props.shopDetail.common_id}
					}
				}>
					<img src={this.props.shopDetail.common_image}/>
					<div className="card_title">
						<div className='shop_desc'>{this.props.shopDetail.common_name}</div>
						{
							this.props.shopDetail.common_price == 0 ?
							<div className='shop_price'>面议</div>
							: <div className='shop_price'>¥ {this.props.shopDetail.common_price}</div>
						}
						{
							this.props.shopDetail.hide
								? <div>
									<span className={`card_sell ${this.props.shopDetail.hide ? '' : 'card_hide'}`}>销量：{this.props.shopDetail.common_salenum}件</span>
									<div className={`card_news ${this.props.shopDetail.hide ? '' : 'card_hide'}`}>
										<p>{this.props.shopDetail.shop_name}</p>
										<div className="card_renzheng">
											<span></span>
											<span></span>
										</div>
									</div>
								</div>
								: ''
						}
					</div>
				</Link>
			</div>
		)
	}
}
